/*************************************************************************
	> File Name: P1449.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-03-03 11:51:51
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;

void calc(char opt, stack<int> &s) {
    int b = s.top();
    s.pop();
    int a = s.top();
    s.pop();
    switch (opt) {
        case '+': s.push(a + b); break;
        case '-': s.push(a - b); break;
        case '*': s.push(a * b); break;
        case '/': s.push(a / b); break;
    }
    return ;
}

int calc(string &str) {
    stack<int> s;
    int num = 0;
    for (int i = 0; i < str.size() && str[i] != '@'; i++) {
        if (str[i] >= '0' && str[i] <= '9') {
            num = num * 10 + str[i] - '0';
        } else if (str[i] == '.') {
            s.push(num);
            num = 0;
        } else {
            calc(str[i], s);
        }
    }
    int result = s.top();
    s.pop();
    return result;
}

int main() {
    string str;
    cin >> str;
    cout << calc(str) << endl;
    return 0;
}
